package no.gnet.edvd.web.controller;

import java.io.Serializable;
import java.util.List;

import no.gnet.edvd.types.Event;
import no.gnet.edvd.types.GenericEvent;

public class EventDescriptor extends GenericEvent implements Serializable{
	private static final long serialVersionUID = -254879254747630520L;
	private int id;
	private String shortname;
	private String description;
	private int likes;
	private List<String> tags;
	private Event event;
	List<OptionWithOdds> optionsWithOdds;
	String betstatus;
	double pot=0.0;
	
	boolean userHasLiked;

	public EventDescriptor(Event anevent, String eventDesc, List<OptionWithOdds> list) {
		super();
		this.id = anevent.id;
		this.shortname = anevent.name;
		this.description=eventDesc;
		this.likes=anevent.likes;
		this.eventPosted=anevent.eventPosted;
		this.event=anevent;
		this.optionsWithOdds=list;
		betstatus=determineBetStatus(list);
		this.setPrivateEvent(anevent.isPrivate());
	}
	

	private String determineBetStatus(List<OptionWithOdds> list) {
		String status = "playable";
		for (OptionWithOdds optionWithOdds : list) {
			if(Double.isNaN(optionWithOdds.getOdds())){
				status="incomplete";
			}
		}
		return status;
	}

	public int getId() {
		return id;
	}
	public String getShortname() {
		return shortname;
	}
	public String getDescription() {
		return description;
	}
	public int getLikes() {
		return likes;
	}
	public Event getEvent() {
		return event;
	}
	
	public List<OptionWithOdds> getOptionsWithOdds(){
		return optionsWithOdds;
	}
	public boolean isUserHasLiked() {
		return userHasLiked;
	}
	public void setUserHasLiked(boolean userHasLiked) {
		this.userHasLiked = userHasLiked;
	}
	public List<String> getTags() {
		return tags;
	}
	public void setTags(List<String> tags) {
		this.tags = tags;
	}
	public String getBetstatus() {
		return betstatus;
	}
	public void setBetstatus(String bettable) {
		this.betstatus = bettable;
	}

	public double getPot() {
		return pot;
	}

	
}
